{% extends 'base.html' %}
{% load tags %}
{% block body %}
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">My_CRM</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">{{ request.user.name }}<span class="caret"></span></a>
                    <ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
                        <li><a href="/logout/">注销</a></li>
                        <li><a href="/password_reset/">修改密码</a></li>
                      </ul>
                    </li>

                </ul>
            </div>
      </div>
    </nav>

    <div class="container" style="margin: 50px; width: auto;">
        {% block continer %}
            <div class="row">
            {% include 'include/sidebar.html' %}
                <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
                    <div class="panel panel-info">
                        <div class="panel-heading">
                            <h3 class="panel-title">后台管理</h3>
                        </div>
                        <div class="panel-body">
                            {% for app_name,app_tables in table_list.items %}
                                <table class="table table-hover">
                                    <thead>
                                        <tr>
                                            <th>{{ app_name }}</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        {% for table_name, admin in app_tables.items %}
                                            <tr>
                                                <td><a href="{% url 'table_detail' app_name table_name %}">{%  render_model_name admin %}</a></td>
                                            </tr>

                                        {% endfor %}
                                    </tbody>
                                </table>
                            {% endfor %}

                        </div>
                    </div>
                </div>
            </div>
        {% endblock %}
    </div>
{% endblock %}

